package online.yangcloud.core.model.entity;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.Table;
import online.yangcloud.common.annotation.DataColumn;
import online.yangcloud.common.annotation.DataIndex;
import online.yangcloud.common.annotation.DataTable;
import online.yangcloud.common.enumration.ColumnTypeEnum;
import online.yangcloud.common.model.BaseParameter;
import org.springframework.stereotype.Component;

/**
 * @author zhuboyang
 * @since 2023年09月04 15:35:56
 */
@Table(value = "video_metadata")
@DataTable(tableName = "video_metadata", desc = "视频元数据")
@Component
public class VideoEntity extends BaseParameter {

    /**
     * 主键
     */
    @DataColumn(primary = true, name = "id", type = ColumnTypeEnum.VARCHAR, length = 32, canNull = false)
    @DataIndex(unique = true)
    @Id(value = "id")
    private String id;

    /**
     * 文件 id
     */
    @DataColumn(name = "file_id", type = ColumnTypeEnum.VARCHAR, length = 32, canNull = false, comment = "文件 id")
    @DataIndex
    @Column(value = "file_id")
    private String fileId;

    /**
     * 缩略图
     */
    @DataColumn(name = "thumbnail", type = ColumnTypeEnum.VARCHAR, length = 128, canNull = false, comment = "视频缩略图地址")
    @Column(value = "thumbnail")
    private String thumbnail;

    /**
     * 总时长
     */
    @DataColumn(name = "duration", type = ColumnTypeEnum.DOUBLE, canNull = false, comment = "总时长")
    @Column(value = "duration")
    private Double duration;

    /**
     * 比特率
     */
    @DataColumn(name = "bitrate", type = ColumnTypeEnum.VARCHAR, length = 20, canNull = false, comment = "比特率")
    @Column(value = "bitrate")
    private String bitrate;

    /**
     * 分辨率-宽
     */
    @DataColumn(name = "width", type = ColumnTypeEnum.SMALLINT, canNull = false, comment = "分辨率宽度")
    @Column(value = "width")
    private Integer width;

    /**
     * 分辨率-高
     */
    @DataColumn(name = "height", type = ColumnTypeEnum.SMALLINT, canNull = false, comment = "分辨率高度")
    @Column(value = "height")
    private Integer height;

    /**
     * 视频编码
     */
    @DataColumn(name = "video_code", type = ColumnTypeEnum.VARCHAR, length = 10, canNull = false, comment = "视频编码")
    @Column(value = "video_code")
    private String videoCode;

    /**
     * 音频编码
     */
    @DataColumn(name = "audio_code", type = ColumnTypeEnum.VARCHAR, length = 10, canNull = false, comment = "音频编码")
    @Column(value = "audio_code")
    private String audioCode;

    public static VideoEntity initial() {
        return new VideoEntity();
    }

    public String getId() {
        return id;
    }

    public VideoEntity setId(String id) {
        this.id = id;
        return this;
    }

    public String getFileId() {
        return fileId;
    }

    public VideoEntity setFileId(String fileId) {
        this.fileId = fileId;
        return this;
    }

    public String getThumbnail() {
        return thumbnail;
    }

    public VideoEntity setThumbnail(String thumbnail) {
        this.thumbnail = thumbnail;
        return this;
    }

    public Double getDuration() {
        return duration;
    }

    public VideoEntity setDuration(Double duration) {
        this.duration = duration;
        return this;
    }

    public String getBitrate() {
        return bitrate;
    }

    public VideoEntity setBitrate(String bitrate) {
        this.bitrate = bitrate;
        return this;
    }

    public Integer getWidth() {
        return width;
    }

    public VideoEntity setWidth(Integer width) {
        this.width = width;
        return this;
    }

    public Integer getHeight() {
        return height;
    }

    public VideoEntity setHeight(Integer height) {
        this.height = height;
        return this;
    }

    public String getVideoCode() {
        return videoCode;
    }

    public VideoEntity setVideoCode(String videoCode) {
        this.videoCode = videoCode;
        return this;
    }

    public String getAudioCode() {
        return audioCode;
    }

    public VideoEntity setAudioCode(String audioCode) {
        this.audioCode = audioCode;
        return this;
    }

    @Override
    public String toString() {
        return "VideoMetadata["
                + " id=" + id + ","
                + " fileId=" + fileId + ","
                + " thumbnail=" + thumbnail + ","
                + " duration=" + duration + ","
                + " bitrate=" + bitrate + ","
                + " width=" + width + ","
                + " height=" + height + ","
                + " videoCode=" + videoCode + ","
                + " audioCode=" + audioCode
                + " ]"
                + " "
                + super.toString();
    }
}
